program main
   implicit none
   integer::i,k,l,l0
   integer::j,num,x,y,x1,y1
   integer,parameter::frac=2**23
   integer,external::gcd
   real::a
   read(*,*)a
   k=transfer(a, 1)
   i=ibits(k, 0, 23)
   l=ibits(k, 23, 8)
   num=0
   do j=0,22
       if(btest(i,j))then
           num=num+2**j
       end if
   end do
   if(l>127)then
       l0=2**(l-127)
       x1=(2**23+num)
       y1=frac
       l=gcd(x1,y1)
       x=gcd(l0,(y1/l))
       write(*,"('分数表示:',g0,'/',g0)")(l0/x)*(x1/l),(y1/l)/x
       write(*,"('IEEE表示:',g0,'*',g0,'/',g0)")l0,x1/l,y1/l
       y=(y1/l)/x
       x=(l0/x)*(x1/l)
   else
       l0=2**(127-l)
       x1=(2**23+num)
       y1=frac
       l=gcd(x1,y1)
       x=gcd(x1/l,l0)
       write(*,"('分数表示:',g0,'/',g0)")(x1/l)/(x),(y1/l)*(l0/x)
       write(*,"('IEEE表示:','1/',g0,'*',g0,'/',g0)")l0,x1/l,y1/l
       y=(y1/l)*(l0/x)
       x=(x1/l)/(x)
   end if
   !2**24=16777216
   write(*,*)'小数结果:',real(x)/real(y)
   write(*,*)'输入数据:',a
end program

function gcd(a,b)result(small)
    implicit none
    integer,intent(in)::a,b
    integer::big,small
    integer::temp
    big=max(a,b)
    small=min(a,b)
    if(small==1)return
    do
        temp=mod(big,small)
        if(temp==0)exit
        big=small
        small=temp
    end do
end function gcd
